package com.dhcc.sds.base.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.dhcc.core.framework.result.node.ZTreeNode;
import com.dhcc.sds.base.entity.SdsDicEntity;
import com.dhcc.sds.base.entity.SdsExpressEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.dhcc.core.framework.base.service.impl.BaseServiceImpl;
import com.dhcc.sds.base.dao.SdsDictypeMapper;
import com.dhcc.sds.base.service.ISdsDictypeService;
import com.dhcc.sds.base.entity.SdsDictypeEntity;

/**
 * 基础字典类型表数据服务层接口
 * 
 * @ClassName: SdsDictypeServiceImpl
 * @Description: TODO
 * @author sunyingjie
 * @date 2021-03-22 10:10:52
 */
@Service("sdsDictypeService")
public class SdsDictypeServiceImpl extends BaseServiceImpl<SdsDictypeMapper, SdsDictypeEntity> implements ISdsDictypeService {

	@Override
	public List<SdsDictypeEntity> page(Page<SdsDictypeEntity> page, Map<String, Object> map) {
		return this.baseMapper.page(page, map);
	}
	@Override
	public List<SdsDictypeEntity> list(Map<String, Object> map) {
		return this.baseMapper.list(map);
	}
	@Override
	public List<ZTreeNode> tree() {
		List<ZTreeNode> tree = this.baseMapper.tree();
		tree.add(ZTreeNode.createRoot("字典类型"));
		return tree;
	}
	@Override
	public JSONObject getDicMap(String typeCode) {
		JSONObject jsObj = new JSONObject();
		List<Map<String, Object>> dicList = this.baseMapper.getDicList(typeCode);
		jsObj.put("","");
		for (Map<String, Object> map : dicList) {
			jsObj.put(map.get("dicId").toString(), map.get("dicDesc").toString());
		}
		return jsObj;
	}
}